﻿using System.Collections.Generic;
using System.Data;
using Tauren.File.Entity.Model;

namespace Tauren.File.DLL.Base
{
    public interface IBaseDLL
    {
        /// <summary>
        /// 添加信息
        /// </summary>
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        long Add<T>(T model, IDbTransaction transaction = null) where T : class, new();
        /// <summary>
        /// 修改信息
        /// </summary>
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Update<T>(T model, IDbTransaction transaction = null) where T : class, new();

        /// <summary>
        /// 删除信息
        /// </summary>
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        bool Delete<T>(T model, IDbTransaction transaction = null) where T : class, new();

        /// <summary>
        /// 获取单个信息
        /// </summary>
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        T Get<T>(object id, IDbTransaction transaction = null) where T : class, new();

        /// <summary>
        /// 获取单个信息--获取基础数据
        /// </summary>
        /// </summary>
        /// <param name="model">实体</param>
        /// <returns></returns>
        T Single<T>(object id, IDbTransaction transaction = null) where T : class, new();

        /// <summary>
        /// 获取所有数据
        /// </summary>
        /// <param name="transaction"></param>
        /// <returns></returns>
        List<T> All<T>(IDbTransaction transaction = null) where T : class, new();
        List<T> GetAll<T>(IDbTransaction transaction = null) where T : class, new();
        /// <summary>
        /// 判断权限
        /// </summary>
        /// <param name="menuId"></param>
        /// <returns></returns>
        List<ExtButtons> JudgePermissions(string MenuCode);
        /// <summary>
        /// 判断是否是系统管理员
        /// </summary>
        /// <param name="EmpId"></param>
        /// <returns></returns>
        bool IsCurrentRoleByAdmin(int EmpId);
        void BuliderDbConnection(string Connections);
        /// <summary>
        /// 根据code获取数据
        /// </summary>
        /// <param name="autoId"></param>
        /// <returns></returns>
        T GetByCode<T>(string code) where T : class, new();
    }
}
